<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <body>

        <ui:composition template="template.xhtml">
            <ui:define name="mainMenu">
                <ui:include src="mainMenu.xhtml"/>
            </ui:define>
            <ui:define name="navigation">
                <ui:include src="menu.xhtml"/> 
            </ui:define>

            <ui:define name="content">
                <h1>
                    #{bundle.EdTitle}
                </h1>
                <h:form>
                    <h:panelGrid styleClass="panelGrid" columns="2" columnClasses="rightAlign, leftAlign">
                        <h:outputText value="#{bundle.TitleOrg}"/>
                        <h:inputText id="titleOrg"
                                     label="#{bundle.TitleOrg}"
                                     value="#{editBean.film.titleOrg}">
                            <f:validateRequired />
                        </h:inputText>

                        <h:outputText value="#{bundle.TitleEn}"/>
                        <h:inputText id="titleEn"
                                     label="#{bundle.TitleEn}"
                                     value="#{editBean.film.titleEn}"/>

                        <h:outputText value="#{bundle.TitlePl}"/>
                        <h:inputText id="titlePl"
                                     label="#{bundle.TitlePl}"
                                     value="#{editBean.film.titlePl}"/>

                        <h:outputText value="#{bundle.Year}"/>
                        <h:inputText id="year" maxlength="4"
                                     label="#{bundle.Year}"
                                     value="#{editBean.film.year}"/>

                        <h:outputText value="#{bundle.Genre}"/>
                        <c:if test="#{localeBean.language == 'pl'}">
                            <h:selectManyListbox  label="#{bundle.Genre}" value="#{editBean.genrePl}" size="10">
                                <c:forEach items="#{editBean.genresFromDB}" var="g">
                                    <f:selectItem itemValue="#{g.namePl}" itemLabel="#{g.namePl}"/>
                                </c:forEach>
                                <f:validateRequired />
                            </h:selectManyListbox>
                        </c:if>
                        <c:if test="#{localeBean.language == 'en'}">
                            <h:selectManyListbox id="languageList" label="#{bundle.Genre}" value="#{editBean.genreEn}" size="10">
                                
                                <c:forEach items="#{editBean.genresFromDB}" var="g">
                                    <f:selectItem itemValue="#{g.nameEn}" itemLabel="#{g.nameEn}"/>
                                </c:forEach>
                                <f:validateRequired />
                            </h:selectManyListbox>
                        </c:if>                        


                        <h:outputText value="#{bundle.Quality}"/>
                        <h:selectOneListbox value="#{editBean.quality}" size="1" >
                            <ui:repeat value="#{editBean.qualitiesFromDB}" var="q">
                                <f:selectItem itemValue="#{q.name}" itemLabel="#{q.name}"/>
                            </ui:repeat>
                            <c:forEach items="#{editBean.qualitiesFromDB}" var="q">
                                <f:selectItem itemValue="#{q.name}" itemLabel="#{q.name}"/>
                            </c:forEach>

                        </h:selectOneListbox>


                        <h:outputText value="#{bundle.Size}"/>
                        <h:inputText id="size" maxlength="6" required="true"
                                     label="#{bundle.Size}"
                                     value="#{editBean.film.fileSize}">

                        </h:inputText>
                        <h:panelGroup></h:panelGroup>
                        <h:commandButton value="#{bundle.Submit}" action="#{editBean.edit}"/>
                    </h:panelGrid>
                    <h:messages styleClass="errorMsg" > </h:messages>

                </h:form>
            </ui:define>


        </ui:composition>

    </body>
</html>
